package com.joel.dsc.sample;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

@Path("/country/{name: [a-zA-Z]+}")
public class CountryDetailResource {

	@GET
	@Produces("text/plain")
	public String getCountry(@PathParam("name") String name) {
		for(Country country: ApplicationData.countries) {
			if (country.getName().equalsIgnoreCase(name)) {
				return country.toString();
			}
		}
		return new Country("").toString();
	}
}
